<extend name="./Application/Admin/View/common/base.html" />
<block name="crumb">
    <span class="c-gray en">&gt;</span> 退货原因管理
    <span class="c-gray en">&gt;</span> 添加退货原因
</block>
<block name="content">
    <form class="form form-horizontal" id="add-brand" method="post">
        <input type="hidden" value="" class="hide_pic">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货原因：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" name="reason" class="input-text radius" placeholder="例如：质量有问题" >
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"></label>
            <button id="save" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
        </div>

    </form>
</block>
<block name="js">
    <script type="text/javascript">
        $(function(){
            //添加退货原因
            $('#save').click(function () {
                var reason = $("input[name='reason']").val();
                if (reason == '') {
                    layer.msg('请填写退货原因！', {icon: 8,time:1000});
                } else {
                    $.ajax({
                        type: 'post',
                        url: "{:U('ReturnGood/addReason')}",
                        data: {
                            'reason': $("input[name='reason']").val()
                        },
                        beforeSend: function () {
                            layer.msg('退货原因添加中..', {icon: 16,time:500});
                        },
                        success: function (msg) {
                            window.location.href = "{:U('ReturnGood/reason')}";

                        }
                    });
                }



            });

        });







    </script>
</block>